Repository navigation
feat(http): the HTTP module loader core - #2
Merged
Merged
Conversation
Response classification (MIME rules, failure texts, the empty-module rule), the remote-module allowlist, registry-key canonicalization and fetch host classes, moved from both runtimes' HttpLoader with identical behavior and failure texts. The core reaches the runtime through link-time platform functions (ns/Platform.h): logging, trace categories, and the runtime's URL normalization and origin. Host tests link a fake platform.
The core now runs every HTTP module fetch and a platform transport only performs single attempts (ns/http/ModuleTransport.h): the gate, the request headers, timeouts, the single transport-error retry, deadline clamping, the synchronous fallback's wait bound, classification, the cache switch with its holders, and Clear-Site-Data. Transports that block run on fetch threads capped per host class; transports that schedule themselves get their retry delay from a core timer thread. Decisions D1-D10 from the design (docs/DESIGN.md section 7 D), including changes from today's runtimes: - the gate is re-checked against the URL a redirect ended at; - User-Agent: NativeScript-HTTP-ESM on every transport; - Clear-Site-Data clears the response and the fetching origin; - failed cache clears are reported through CacheOpResult.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 5 of the migration plan (docs/DESIGN.md §9): the HTTP module loader's policy and orchestration move into the core, behind a one-attempt transport seam. Both runtimes adopt it in follow-up PRs; nothing consumes it yet.
Changes users will see once the runtimes adopt it
security.remoteModuleAllowlistrefuses a module whose redirect ends outside the allowlist. A transport that cannot report the final URL fails closed and logs once.User-Agent: NativeScript-HTTP-ESM(Android already did).CacheOpResult), as Android's were.Commits
feat(http): lift the HTTP module loader's policy into the core: classification, the allowlist, canonicalization and host classes, moved with identical behavior and failure texts. Link-time platform functions inns/Platform.h.feat(http): own the module fetch orchestration behind a transport seam:ns/http/ModuleTransport.handns/http/ModuleFetch.h. The core owns the gate, headers, timeouts, the single transport-error retry, deadline clamping, the sync fallback's wait bound, the cache switch with its holders, Clear-Site-Data, and capped fetch threads for transports that block. D1–D10 are recorded as decided in DESIGN.md §7 D.Tests
Host tests against a fake platform and transport: the gate and the post-redirect check with
isDebug=false(the device suites run Debug and never reach the gate), retries, deadlines, both scheduling modes, lane caps, the cache switch, and Clear-Site-Data. They pass under ASan/UBSan and TSan locally. Mutating the fail-closed check, the retry limit or the origin dedupe makes them fail.